<%@ page language="java" import="java.util.*" import="entity.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%user u=((user)session.getAttribute("user")); 
String name=null;
if (u!=null){
	name=u.getUser_name();
}
List<trammel>trammels=((List<trammel>)request.getAttribute("trammels"));
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'home.jsp' starting page</title>
    <meta charset="utf-8"> 
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<link rel="stylesheet" type="text/css" href="style2.css">
	<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
	<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz" crossorigin="anonymous"></script>
  </head>
<body>



<nav class="navbar navbar-expand-sm navbar-dark" style="background-color: #333333;">
  <a class="navbar-brand" href="./home">
    云顶之奕WiKi
  </a>
  <div class="collapse navbar-collapse" id="navbarNav">
    <ul class="navbar-nav">
      <li class="nav-item">
        <a class="nav-link" href="./hero_guide">英雄图鉴</a>
      </li>
      <li class="nav-item">
        <a class="nav-link" href="./equip_guide">装备图鉴</a>
      </li>
      <li class="nav-item">
        <a class="nav-link" href="./hex_guide">海克斯图鉴</a>
      </li>
      <li class="nav-item">
        <a class="nav-link" href="./trammel_guide">羁绊图鉴</a>
      </li>
      <li class="nav-item">
        <a class="nav-link" href="./all_army">阵容查看</a>
      </li>
      <li class="nav-item">
        <a class="nav-link" href="./my_army">我的阵容</a>
      </li>
      <li class="nav-item">
        <a class="nav-link" href="./edit_army">阵容编辑</a>
      </li>
    </ul>
  </div>
  <%if (name==null){%>
  <div class="col-md-3 text-end">
    <button type="button" onclick="window.location.href='./account_manage/login.jsp'" class="btn btn-outline-light me-2">登录</button>
    <button type="button" onclick="window.location.href='./account_manage/sign.jsp'" class="btn btn-warning">注册</button>
  </div>
  <%}
  else{ %>
  <div class="col-md-3 text-end">
  <a class="nav-link text-light"><%=name %></a>
  </div>
  <%} %>
  
  <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
    <span class="navbar-toggler-icon"></span>
  </button>
</nav>
	<div class="d-flex justify-content-center align-items-center h-100">
	   <h1>已有同名用户，页面将在5秒后跳转注册界面...</h1>
	   </div>
  </body>
</html>
<script>
        // 定时器函数，单位毫秒
        function redirectToPage(delay) {
            setTimeout(function() {
                // 要跳转的页面URL
                var url = "./account_manage/login.jsp";
                // 跳转到指定页面
                window.location.href = url;
            }, delay);
        }
 
        // 页面加载完成后启动定时器
        window.onload = function() {
            // 延迟时间，例如5000毫秒
            var delay = 5000;
            redirectToPage(delay);
        };
    </script>